import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '物业编号',
    align:"center",
    dataIndex: 'wybh'
   },
   {
    title: '序号',
    align:"center",
    dataIndex: 'cnt'
   },
   {
    title: '使用年限',
    align:"center",
    dataIndex: 'synx'
   },
   {
    title: '起始日期',
    align:"center",
    dataIndex: 'qsrq'
   },
   {
    title: '结束日期',
    align:"center",
    dataIndex: 'jsrq'
   },
   {
    title: '签约日期',
    align:"center",
    sorter: true,
    dataIndex: 'qyrq'
   },
   {
    title: '合同编号',
    align:"center",
    dataIndex: 'htbh'
   },
   {
    title: '签约名称',
    align:"center",
    dataIndex: 'qymc'
   },
   {
    title: '租赁方式',
    align:"center",
    dataIndex: 'zrfs'
   },
   {
    title: '厂中厂',
    align:"center",
    dataIndex: 'czc'
   },
   {
    title: '使用权人',
    align:"center",
    dataIndex: 'syqr'
   },
   {
    title: '使用面积',
    align:"center",
    dataIndex: 'jzmj'
   },
   {
    title: '房产证',
    align:"center",
    dataIndex: 'fcz'
   },
   {
    title: '房产证号',
    align:"center",
    dataIndex: 'fczh'
   },
   {
    title: '办证方',
    align:"center",
    dataIndex: 'bzf'
   },
   {
    title: '领证日期',
    align:"center",
    dataIndex: 'lqrq'
   },
   {
    title: '使用方',
    align:"center",
    dataIndex: 'syf',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'1'},{text:'否',value:'0'}])
     },
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "签约日期",
      field: 'qyrq',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "合同编号",
      field: 'htbh',
      component: 'JInput',
      colProps: {span: 6},
 	},
	{
      label: "签约名称",
      field: 'qymc',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "使用权人",
      field: 'syqr',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '物业编号',
    field: 'wybh',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入物业编号!'},
          ];
     },
  },
  {
    label: '序号',
    field: 'cnt',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入序号!'},
          ];
     },
  },
  {
    label: '使用年限',
    field: 'synx',
    component: 'InputNumber',
  },
  {
    label: '起始日期',
    field: 'qsrq',
    component: 'Input',
  },
  {
    label: '结束日期',
    field: 'jsrq',
    component: 'Input',
  },
  {
    label: '签约日期',
    field: 'qyrq',
    component: 'Input',
  },
  {
    label: '合同编号',
    field: 'htbh',
    component: 'Input',
  },
  {
    label: '签约名称',
    field: 'qymc',
    component: 'Input',
  },
  {
    label: '租赁方式',
    field: 'zrfs',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入租赁方式!'},
          ];
     },
  },
  {
    label: '厂中厂',
    field: 'czc',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入厂中厂!'},
          ];
     },
  },
  {
    label: '使用权人',
    field: 'syqr',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入使用权人!'},
          ];
     },
  },
  {
    label: '使用面积',
    field: 'jzmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入使用面积!'},
          ];
     },
  },
  {
    label: '房产证',
    field: 'fcz',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'is_exist_certificates'
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入房产证!'},
          ];
     },
  },
  {
    label: '房产证号',
    field: 'fczh',
    component: 'Input',
  },
  {
    label: '办证方',
    field: 'bzf',
    component: 'Input',
  },
  {
    label: '领证日期',
    field: 'lqrq',
    component: 'Input',
  },
  {
    label: '使用方',
    field: 'syf',
     component: 'JSwitch',
     componentProps:{
         options:[1,0]
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入使用方!'},
          ];
     },
  },
  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
